/*	
	This program is free software; you can redistribute it and/or modify 
	it under the terms of the GNU General Public License as published by 
	the Free Software Foundation; either version 2 of the License, or 
	any later version.

    	This program is distributed in the hope that it will be useful, but 
	WITHOUT ANY WARRANTY; without even the implied warranty of 
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
	General Public License for more details.

    	You should have received a copy of the GNU General Public License 
	along with this program; if not, write to the Free Software 
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
	USA
*/

#include<cmos.h>
int read_cmos(int addr) {
	int valore;
	out_port(0x70,addr|0x80);
	valore=in_port(0x71);
}

void put_config() {
	cmos_secondi=read_cmos(0x0);
	cmos_secondi=((cmos_secondi>>4)*10)+(cmos_secondi&0xF);
	cmos_minuti=read_cmos(0x2);
	cmos_minuti=((cmos_minuti>>4)*10)+(cmos_minuti&0xF);
	cmos_ora=read_cmos(0x4);
	cmos_ora=((cmos_ora>>4)*10)+(cmos_ora&0xF);
	cmos_giorni=read_cmos(0x7);
	cmos_giorni=((cmos_giorni>>4)*10)+(cmos_giorni&0xF);
	cmos_mese=read_cmos(0x8);
	cmos_mese=((cmos_mese>>4)*10)+(cmos_mese&0xF);
	cmos_anno=read_cmos(0x9);
	cmos_anno=((cmos_anno>>4)*10)+(cmos_anno&0xF);
	cmos_anno+=2000;
}
